package learn02;
import java.util.Scanner;
import java.util.Date;
import java.text.SimpleDateFormat;

public class leaen_02 {
    public static void main(String[] args)throws Exception{
        //创建输入对象
        String strr="2019/05/01";
        stringTodate(strr);
    }

    public static void stringTodate(String strr)throws Exception{
        //获取用户输入的字符串
        String str;
        Scanner sc=new Scanner(System.in);
        while(true) {
            System.out.println("请输入年月日，格式如：2020/01/01");
            str = sc.nextLine();
            try {
                //System.out.println("你输入的日期为：" + str);
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
                Date date = sdf.parse(str);
                Date dater = sdf.parse(strr);
                long lo1 = date.getTime();
                Long lo2 = dater.getTime();
                long days = (lo1 - lo2) / (24 * 60 * 60 * 1000);
                String substr=str.substring(5);
                String beTogether="05/01";
                String beKiss="05/04";
                String besweet="05/20";
                //int num=0;
                if(substr.equals(beTogether)){
                    System.out.println("已经" + days + "天咯❤");
                }else if(substr.equals(beKiss)){
                    System.out.println("已经" + days + "天咯❤");
                }else if(substr.equals(besweet)){
                    System.out.println("已经" + days + "天咯❤");
                }else{
                    System.out.println("已经" + days + "天咯");
                }
            } catch (Exception e) {
                System.out.println("输入错误，请重新输入");
                continue;
            }
            sc.close();
            break;
        }

    }


}
